﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex04.Menus.Interfaces
{
    public class MainMenu
    {
        private readonly SubMenu m_MainItemsCollection;

        public SubMenu MainItemsCollection
        {
            get { return m_MainItemsCollection; }
        }

        public MainMenu()
        {
            m_MainItemsCollection = new SubMenu();
        }

        public void Add(MenuItem i_ItemToAdd)
        {
            MainItemsCollection.Add(i_ItemToAdd);
            if (MainItemsCollection.ItemList.Count == 2)
            {
                MainItemsCollection.ItemList[0].Title = "Exit";
            }
        }

        public void Show()
        {
            MainItemsCollection.DoWhenSelected();
        }
    }
}
